package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.ClassSchedule;
import cn.wolfcode.crm.mapper.ClassScheduleMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IClassScheduleService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class ClassScheduleServiceImpl implements IClassScheduleService {
    @Autowired
    private ClassScheduleMapper classScheduleMapper;


    public int insert(ClassSchedule record) {

        return classScheduleMapper.insert(record);
    }

    public List<ClassSchedule> selectAll() {
        return classScheduleMapper.selectAll();
    }

    public PageResult query(QueryObject qo) {
        int total = classScheduleMapper.query4Count(qo);
        if(total > 0){
            return new PageResult(total,classScheduleMapper.query4List(qo));
        }
        return new PageResult(total, Collections.EMPTY_LIST);
    }

    public void updateByPrimaryKey(ClassSchedule classSchedule) {
        classScheduleMapper.updateByPrimaryKey(classSchedule);
    }

}
